package com.swgk.core.view.adapter;

import android.graphics.Color;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;

import androidx.databinding.BindingAdapter;

/**
 * @author : younghow
 * @date : 2021/11/18 15:21
 * description:
 */
public class TextViewBindingAdapter {

    @BindingAdapter("textForStar")
    public static void setTextForStar(TextView text, String s){
        SpannableString spannableString = new SpannableString(s);
        spannableString.setSpan(new ForegroundColorSpan(Color.rgb(255,41,40)),s.indexOf("*"),s.length(),SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
        text.setText(spannableString);
    }
}
